import service from "@/api/index.js";
const goodsApi={
    //添加
    inster(goods){
      return  service.post("/goods",goods);
    },
    delete(id){
        return service.delete(`/goods/${id}`);
    },
    //修改
    update(goods){
        return service.put('/goods',goods);
    },
    //分页搜索
    selectByPage(condition,pageNum,pageSize){
        condition.pageNum = pageNum;
        condition.pageSize = pageSize;
        return service.get("/goods/",{
            params: condition
        })
    },
    //分页搜索-注意分类id既可以是父分类Id又可以是子分类的id
    selectByPage1(condition,pageNum,pageSize){
        condition.pageNum = pageNum;
        condition.pageSize = pageSize;
        return service.get("/goods/search",{
            params: condition

        })
    },
    selectById(id){
        return service.get(`/goods/${id}`);
    },
    selectByGroupByCategory() {
        return service.get("/goods/selectByGroupByCategory")
    }
};
export default goodsApi;